<?php
namespace Admin\Controller;
use Think\Controller;
class IndexController extends BaseController {
    public function index(){

    	$this->display();
    }
    //网站配置
    public function indexInfo(){
    	$this->display();
    }

   	public function config(){
        if(IS_POST) {
            $data = $_POST;
            foreach ($_FILES as $key => $value) {
                if($value['name']) {
                  $R =  D('Home/File')->singleUpload($value);
                  $data[$key] = $R['id'];
                }
            }

            $R = D('Home/Config')->setVal($data);
            if($R['e'] < 1) {
              $this->error('操作失败');
            }
            $this->success('操作成功', U('Index/config'));
            
        } else {
          $data = D('Home/Config')->_lists();
          $this->assign('data', $data);
          $this->display();
        }
   	}
    
}